<?php
error_reporting(E_ALL ^E_DEPRECATED ^E_STRICT);
//マシン環境定義クラスモジュール
require_once dirname(__FILE__) . '/environment.php';
define('APPLICATION_NAME', 'JSC');
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
define('APP_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
// require_once dirname(__FILE__) . '/include_path_env.php';
 set_include_path(
 	env::ゼンドフレームワークインクルードパス . PATH_SEPARATOR . get_include_path()
);
set_include_path(
	env::マイリブインクルードパス . PATH_SEPARATOR . get_include_path()
);
set_include_path(
	env::スマーティインクルードパス . PATH_SEPARATOR . get_include_path()
);
// セッションクラスインスタンス
require_once 'Session.php';
global $SESSION;
$SESSION = new Lib_Session();
// SMARTY使用宣言
//define('USE_SMARTY', '1');
$myDir = dirname(__FILE__);
$myDir = str_replace("\\",'/' , $myDir);
$documentRoot = $_SERVER['DOCUMENT_ROOT'];
$applicationWebPath = str_replace($documentRoot, '', $myDir);
if ($applicationWebPath != '') {
	$applicationWebPath .= '/';
}
if ( isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on' ) {
	$applicationWebPath = 'https://' . $_SERVER['HTTP_HOST'] . '/' . $applicationWebPath;
} else {
	$applicationWebPath = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $applicationWebPath;
}
define('APPLICATION_WEB_PATH' , $applicationWebPath);
// Zend_View_Smarty
require_once 'Zend/Controller/Action/Helperbroker.php';
if (defined('USE_SMARTY')){	require_once 'Smarty/Zend_View_Smarty.php';
	$view = new Zend_View_Smarty(APP_PATH . '/views/scripts');
	$viewRenderer =  Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
	$viewRenderer->setView($view)
	             ->setViewBasePathSpec($view->_smarty->template_dir)
	             ->setViewScriptPathSpec(':controller/:action.:suffix')
	             ->setViewScriptPathNoControllerSpec(':action.:suffix')
	             ->setViewSuffix('html');
	$view->getEngine()->compile_dir = APP_PATH . '/views/data/templates_c';
} else {
	Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setViewSuffix('tpl');
}
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();
